package edu.pku.sei.transformation.editor.controller.commands.link;

import edu.pku.sei.transformation.editor.model.Domain;
import edu.pku.sei.transformation.editor.model.DomainConnection;
import edu.pku.sei.transformation.editor.model.Rule;

public class DomainConnectionDeleteCommand extends AbstractLinkDeleteCommand<DomainConnection, Rule, Domain> {
	public DomainConnectionDeleteCommand(DomainConnection link,
			Rule source, Domain target) {
		super(link, source, target);
	}

	@Override
	public void execute() {
		this.source.getDomainConnection().remove(link);
		this.link.setDomain(null);
	}

	@Override
	public void undo() {
		this.link.setDomain(this.target);
		this.source.getDomainConnection().add(this.link);
		this.target.setContainer(this.source);
	}
}
